//
//  MainTableViewController.m
//  Yarhoo
//
//  Created by 杨春至 on 2018/5/24.
//  Copyright © 2018年 Yarhoo. All rights reserved.
//

#import "MainTableViewController.h"
#import "BaseNaviViewController.h"
#import "UIImage+NTESColor.h"

@interface MainTableViewController ()

@end

@implementation MainTableViewController

- (instancetype)init
{
    if (self = [super init]) {
        
        NSMutableArray *mArr = [NSMutableArray array];
        NSArray *arr = @[
                         @{@"title":@"惠空间",
                           @"image":@"home_tab0",
                           @"hl_image":@"home_tab1",
                           @"class":@"HomeViewController"},
                         @{@"title":@"会员权益",
                           @"image":@"vips_tab0",
                           @"hl_image":@"vips_tab1",
                           @"class":@"VipSpaceViewController"},
                         @{@"title":@"传输列表",
                           @"image":@"trans_tab0",
                           @"hl_image":@"trans_tab1",
                           @"class":@"TransPortListViewController"},
                         @{@"title":@"看吧",
                           @"image":@"see_tab0",
                           @"hl_image":@"see_tab1",
                           @"class":@"SeeBarViewController"},
                         @{@"title":@"更多",
                           @"image":@"more_tab0",
                           @"hl_image":@"more_tab1",
                           @"class":@"MoreFuncViewController"},
                         ];
        
        for (int i = 0; i < arr.count; i++) {
            NSDictionary *dic = arr[i];
            
            UIViewController *vc = [[NSClassFromString(dic[@"class"]) alloc] init];
            
            BaseNaviViewController *nav = [[BaseNaviViewController alloc] initWithRootViewController:vc];
            nav.tabBarItem.image = [UIImage imageNamed:dic[@"image"]];
            nav.tabBarItem.selectedImage = [[UIImage imageNamed:dic[@"hl_image"]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
            vc.title = dic[@"title"];
            [mArr addObject:nav];
        }
        
        self.viewControllers = mArr;
//        self.tabBar.tintColor = kColorYellowFFCC00;
//        self.tabBar.barTintColor = kColorTitleA5A8Ad;
        if (@available(iOS 10.0, *)) {
//            self.tabBar.unselectedItemTintColor = kColorTitleA5A8Ad;
        } else {
//            self.tabBar.barTintColor = kColorTitleA5A8Ad;
        }
        //        self.tabBar.backgroundImage = [UIImage imageNamed:@"tabbar_bg"];
        self.tabBar.backgroundImage = [UIImage imageWithColor:[UIColor whiteColor]];
        //        self.tabBar.shadowImage = [UIImage new];
    }

    
    return self;
}


@end
